import table from '@/components/dt/table/render.js'
import nameOpt from '@/biz/option/name.js'
import dateOpt from '@/biz/option/date.js'
import Opt from '@/components/dt/info/Opt.js'
import dt from '@dt/dt'

let _this = null

class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        title: '序号',
        field: 'name',
        width: 100,
        align: 'center',
        slots: {
          default: (params, h) => {
            return params._rowIndex - 0 + 1
          }
        }
      },
      {
        title: '商务点数',
        field: 'commercePoints',
        width: 180,
        align: 'center'
      },
      {
        title: '调整内容',
        field: 'adjustingContent',
        minWidth: 180,
        align: 'center'
      },
      {
        title: '预估理论收入（万元）',
        field: 'estimateIncome',
        width: 180,
        align: 'center',
        cell: {
          text: {
            type: 'number'
          }
        }
      },
      {
        title: '创建日期',
        field: 'createTime',
        width: 180,
        align: 'center'
      },
      {
        title: '操作',
        fixed: 'right',
        width: 140,
        align: 'center',
        cell: (item) => {
          let btn = []
          btn.push({
            title: '编辑',
            event: 'edit',
            code: '0102011202'
          })
          btn.push({
            title: '删除',
            event: 'remove',
            code: '0102011203'
          })
          return {
            btn
          }
        }
      }
    ]
  }
}

export default Column
